package com.lj.infoisland.domain.po;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * 新闻表
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "news")
public class News implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_UUID)
    /*
     * id
     */
    private String id;

    /**
     * 标题
     */
    @TableField(value = "title")
    private String title;

    /**
     * 描述
     */
    @TableField(value = "description")
    private String description;

    /**
     * 分类id
     */
    @TableField(value = "category_id")
    private String categoryId;

    /**
     * 内容url地址
     */
    @TableField(value = "content_url")
    private String contentUrl;

    /**
     * 封面图片url地址
     */
    @TableField(value = "cover_image")
    private String coverImage;

    /**
     * 作者唯一标识
     */
    @TableField(value = "user_unique_id")
    private String userUniqueId;

    /**
     * 是否发布 0表示未发布，1表示发布
     */
    @TableField(value = "is_published")
    private int isPublished;


    /**
     * 浏览量
     */
    @TableField(value = "view_num")
    private Integer viewNum;

    /**
     * 点赞量
     */
    @TableField(value = "like_num")
    private Integer likeNum;

    /**
     * 收藏量
     */
    @TableField(value = "favorite_num")
    private Integer favoriteNum;

    /**
     * 新闻状态 0: 待审核 1: 审核通过 2: 审核不通过
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 发布时间
     */
    @TableField(value = "published_at", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date publishedAt;
}